package com.managedbean;

import javax.ejb.EJB;
import javax.enterprise.context.RequestScoped;
import javax.enterprise.context.SessionScoped;
import javax.inject.Named;

import com.service.CompanyEJB;
import com.woupla.model.Company;

import java.io.Serializable;

/**
 * 
 */

/**
 * @author Dimitri Lebel
 * 
 */
@Named
@SessionScoped
public class CompanyMBean implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = -8912254295304875243L;
	@EJB
	private CompanyEJB companyEJB;
	private Company company;

	/**
	 * @return the companyEJB
	 */
	public CompanyEJB getCompanyEJB() {
		return companyEJB;
	}

	/**
	 * @param companyEJB
	 *            the companyEJB to set
	 */
	public void setCompanyEJB(CompanyEJB companyEJB) {
		this.companyEJB = companyEJB;
	}

	/**
	 * @return the company
	 */
	public Company getCompany() {
		return company;
	}

	/**
	 * @param company
	 *            the company to set
	 */
	public void setCompany(Company company) {
		this.company = company;
	}

	public CompanyMBean() {
		company = new Company();
	}

	public void create() {
		companyEJB.saveCompany(company);
	}
}
